package bbs;

import common.db.DBExecute;
import common.main.MainBean;

public class BbsSerachBean extends MainBean
{
	public void funcExecute() throws Exception
	{
		
		queryBuffer = new StringBuffer("");
		queryBuffer.append("SELECT DATA_NUM, DISP_NUM, GROUP_NUM, STEP, DEPTH, WIDTH, ");
		queryBuffer.append("SEQ, TITLE, HIT_CNT, REG_ID, NAME, REG_DATE, ADD_CNT ");
		queryBuffer.append("FROM (SELECT ROWNUM DATA_NUM, DISP_NUM, GROUP_NUM, STEP, DEPTH, WIDTH, ");
		queryBuffer.append("SEQ, TITLE, HIT_CNT, REG_ID, NAME, REG_DATE, ADD_CNT ");
		queryBuffer.append("FROM ( SELECT ROWNUM DISP_NUM, GROUP_NUM, STEP, ");
		queryBuffer.append("DEPTH, WIDTH, SEQ, TITLE, HIT_CNT, REG_ID, NAME, REG_DATE, ADD_CNT ");
		queryBuffer.append("FROM (SELECT a.GROUP_NUM, a.STEP, a.DEPTH, a.WIDTH, a.SEQ, a.TITLE, a.HIT_CNT, a.REG_ID, ");
		queryBuffer.append("b.NAME, TO_CHAR(a.REG_DATE, 'YYYY-MM-DD') REG_DATE, COUNT(c.SEQ) ADD_CNT ");
		queryBuffer.append("FROM BBS a, MEMBER b, (SELECT SEQ, BBS_SEQ FROM BBS_ADD WHERE DISP_YN='Y') c ");
		queryBuffer.append("WHERE a.REG_ID=b.ID AND a.SEQ=c.BBS_SEQ(+) AND a.DISP_YN='Y' ");
		queryBuffer.append("GROUP BY a.GROUP_NUM, a.STEP, a.DEPTH, a.WIDTH, a.SEQ, ");
		queryBuffer.append("a.TITLE, a.HIT_CNT, a.REG_ID, b.NAME, a.REG_DATE ORDER BY ");
	//	queryBuffer.append("GROUP_NUM ASC, "+sort+" DESC ) ORDER BY DISP_NUM DESC ) )");
	//	queryBuffer.append("WHERE DATA_NUM>="+articleStartNum+" AND DATA_NUM<="+articleEndNum);

		DBExecute dbe = new DBExecute(queryBuffer.toString());
		outputList = dbe.getDataList();
	}
}
